<?php

class Public_Post_CommentSuccessView extends BlogPublicBaseView
{
	public function executeHtml(AgaviRequestDataHolder $rd)
	{
		$this->setupHtml($rd);
		/* @var $model Public_PostsModel */
		$model = $this->getContext()->getModel('Posts', 'Public');
		// redirect to post page
		$params = $rd->getParameters();
		
		// form 'permalink' view of the comment
		$post = $model->getPost($params['post_id']);
		$route_elements = $model->getPostCoordinates($post);
        if (!$this->getAttribute('approved')) {
            $route_elements['comment_on_moderation'] = '1';
        }
        $this->setRoutingRedirect('post.view', $route_elements);
	}
}

?>
